////////////////////////////////////////////////////////////////////////////////////
// File:        EsetManager.h
// Purpose:     Class which loads all Eset Information if it is installed, inserts
//              a new license and recovers the current license
// Author:      Tukero
// Copyright:   (c) Tukero <tukero@gmail.com>
// Licence:     GNU/LGPL v3
////////////////////////////////////////////////////////////////////////////////////

#ifndef _TNOD_ESETMANAGER_
#define _TNOD_ESETMANAGER_

#ifndef WX_PRECOMP
#  include <wx/wx.h>
#else
#  include <wx/wxprec.h>
#endif

#include <wx/regex.h>
#include <wx/buffer.h>
#include <wx/msgdlg.h>

#include "License.h"
#include "EsetInfo.h"

class EsetManager : public EsetInfo
{    
private:
    wxString m_Profile;                                //Current profile name
    wxString m_ProfilePath;                            //Registry path of current profile  

    wxString GetKey2Unlock();
public:
    bool     m_RestoreActiveWindow;

    EsetManager();
    int     InsertLicense(License& license, wxThread *thread = NULL);
    void    LoadInfo();
    License RecoverLicense();

    // Return the Username used in NOD32
    wxString GetUsername();

    // Return the Password in binary-string format
    wxString GetPassword();

    bool     IsEsetInstalled() const;

    wxString GetProfileSettingsPath();
    wxString GetProfileSetting(wxString section);
    void     GetCurrentLicense(License &license);
    bool     IsCurrentLicenseSameAs(License& license);
    void     UpdatePath(License *license2Insert = NULL, bool *inserted = NULL);
    bool     SetLicenseInRegistry(wxString settingsPath, License *license2Insert);
    bool     WaitInsertion(License& license);

    int      UnlockWithPass(HWND& nodHandler, HWND& dlgHandle, HWND& containerHandle, wxThread *thread = NULL);
};

#endif